const { getApi } = require("./get-api-doc");
const { generateModuleMap } = require("./util");
const { generateApi } = require("./generator");

async function __main__() {
  const [url] = process.argv.splice(2);
  const { tags, paths, definitions } = await getApi(url);
  const moduleMap = generateModuleMap(tags);
  generateApi(paths, moduleMap, definitions);
}

__main__()
  .then(() => console.log("api-generator success"))
  .catch((err) => console.log("api-generator error", err));
